1. Field of the Invention
The present invention relates to a system and a method for configuration and management of flash memory and, more particularly, to a system and a method for managing flash memory access and reconfiguring data access control unit of flash memory.
2. The Related Arts
The flash memory is widely used in storing multimedia data, such as digital images or audio data. However, conventional methods of data access and management of flash memory include the following two categories.
The first category of methods employs a large-size lookup table. The lookup table records the mapping of a logical block address (LBA) to a physical address. This provides good data access efficiency because the mapping of an LBA to a physical address can be easily found in the lookup table. The drawback is that this method requires a large amount of memory for the lookup table. For example, for a 512 MB flash memory with the block size of 512 bytes, there will be 1,048,576 LBAs. If the system uses four bytes to represent a physical address, the method requires 4 MB of physical memory to store the lookup table.
The second category of methods also employs a lookup table, but the lookup table only records the mapping of logical erase unit to a physical erase unit. When an LBA is mapped to a physical address, the LBA is divided into two parts. The first part is the logical erase unit address, and the second part is the offset within the logical erase unit. For example, if a logical erase unit can store 32 logical blocks, the logical erase unit address is the quotient of the LBA divided by 32, and the offset is the modulo of the LBA divided by 32. Then the logical erase unit address is mapped to a physical erase unit address according to the lookup table, which is added with the offset to obtain the physical address mapping to the LBA. This method greatly reduces the memory required by the lookup table. However, the drawback is that the data access efficiency is poor because the entire data in the writen[T1] erase unit must be copied to an empty erase unit and then the data is writen to the corresponding location within the erase unit. Finally, the data in the original erase unit is erased. Because the flash memory takes much time in copying and erasing the data, the efficiency is reduced.
U.S. Pat. No. 5,937,425 disclosed a method called NFTL method. The NFTL method is a variation of the above second category of methods. In the NFTL method, a logical erase unit is mapped to one or more physical erase units, and all the physical erase units mapped to the same logical erase unit are arranged into a linked list. When the data is to be written to a logical block, the NFTL method uses the above method to find the corresponding logical erase unit and the corresponding linked list. Then, a search is conducted from the beginning of the linked list to check whether the corresponding offset of that physical erase unit has been written. If so, the next physical erase unit is checked. This repeats until a physical erase unit whose corresponding offset has never been written before is found, and the data is written to that address. If the corresponding offset in all the physical erase units in the linked list has been written, a new empty physical erase unit is added to the linked list, and the data is written to the corresponding offset in the new added physical erase unit. Similarly, when a data is to be read from a logical block, the method must find the corresponding linked list and start the search. The search is for the address that has been written before, which indicates the data is most recent, and then the data is read. In the NFTL method, a search must always be conducted for both read and write requests. Therefore, the data access efficiency is also poor when the linked list is long.